import axios from 'axios';
import Vue from 'vue';
Vue.prototype.$http = axios;

axios.interceptors.request.use((config) => {
    // config.headers.token = window.sessionStorage.getItem('token');
    return config;
});

axios.interceptors.response.use(
    (response) => {
        return response;
    },
    (error) => {
        if (error.response.code === 401) {
            window.location.href = '/login';
        }
        return Promise.reject(error);
    },
);
